package org.example.spring.ioc.factory;

import org.example.spring.ioc.bean.Car;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

@Component
public class BYDFactory implements FactoryBean<Car> {
    @Override
    //调用此方法给容器中创建对象
    public Car getObject() throws Exception {
        System.out.println("创建BYD车");
        Car car = new Car();
        return car;
    }

    @Override
    //说明创建的这个对象的类型
    public Class<?> getObjectType() {
        return Car.class;
    }

    @Override
    //返回true 表示这个bean是单例的，false 表示多例
    public boolean isSingleton() {
        return true;
    }
}
